using System;
using System.Collections.Generic;
using System.Text;

namespace Adoor.Collections.Generic
{
    public delegate void CollectionChangeEventHandler<T>(object sender, CollectionChangeEventArgs<T> e);

    public class CollectionChangeEventArgs<T> : EventArgs
    {
        // Summary:
        //     Initializes a new instance of the System.ComponentModel.CollectionChangeEventArgs
        //     class.
        //
        // Parameters:
        //   element:
        //     An System.Object that specifies the instance of the collection where the
        //     change occurred.
        //
        //   action:
        //     One of the System.ComponentModel.CollectionChangeAction values that specifies
        //     how the collection changed.
        public CollectionChangeEventArgs(CollectionChangeAction action, T element)
        {
            this.action = action;
            this.element = element;
        }

        private CollectionChangeAction action;

        // Summary:
        //     Gets an action that specifies how the collection changed.
        //
        // Returns:
        //     One of the System.ComponentModel.CollectionChangeAction values.
        public virtual CollectionChangeAction Action { get { return action; } }

        private T element;

        public virtual T Element { get { return element; } }
    }

    // Summary:
    //     Specifies how the collection is changed.
    public enum CollectionChangeAction
    {
        // Summary:
        //     Specifies that an element was added to the collection.
        Add = 1,
        //
        // Summary:
        //     Specifies that an element was removed from the collection.
        Remove = 2,
        //
        // Summary:
        //     Specifies that the entire collection has changed. This is caused by using
        //     methods that manipulate the entire collection, such as System.Collections.CollectionBase.Clear().
        Refresh = 3,
    }
}
